2 <TITLE>Interpolation (in-place) sort
7 <A HREF="../../images/handbook.gif"><IMG SRC="../../images/handbook2.gif" align=left></A>
8 <A HREF="../../hbook.html">
9 <IMG SRC="../../images/home_g.gif" hspace = 15 vspace = 4 ALT = "[Home]"></A><BR>
10 <A HREF="../../expand.html">
11 <IMG SRC="../../images/contents_g.gif" hspace = 15 vspace = 4 ALT = "[Contents]"></A><BR>
12 <A HREF="../../sort_a.html">
13 <IMG SRC="../../images/chapter_g.gif" hspace = 15 vspace = 4 ALT = "[Chapter]"></A><BR>
14 <A HREF="416.sort.c.html"><IMG SRC="../../images/prevalg_g.gif" hspace = 15 vspace = 4 ALT = "[Previous Algorithm]"></A><BR>
15 <A HREF="417.sort.c.html">
16 <IMG SRC="../../images/nextalg_g.gif" hspace = 15 vspace = 4 ALT = "[Next Algorithm]"></A><BR>
20 <H2><B>Interpolation (in-place) sort
37 for (i=lo; i<=up; i++) {iwk[i] = 0; r[i].k = -r[i].k;}
39 for (i=lo; i<=up; i++) iwk[ phi(-r[i].k,lo,up) ]++;
40 for (i=lo; i<up; i++) iwk[i+1] += iwk[i];
41 for (i=up; i>=lo; i--) if ( r[i].k<0 )
44 j = iwk[ phi( r[i].k, lo, up ) ]--;
49 for ( i=up-1; i>=lo; i-- ) {
51 for ( j=i+1; j<=up && (tempr.k>r[j].k); j++ )
56 </XMP></TD></TR></TABLE>
58 <H3><A HREF="ftp://sunsite.dcc.uchile.cl/pub/users/rbaeza/handbook/algs/4/416b.sort.c"><IMG SRC="../../images/ftp.xbm" hspace=10>C</A> source (416b.sort.c) </H3></CENTER>
60 <IMG SRC="../../images/aw3.gif" align=left><H5><BR>
61 © <A HREF="http://aw.com">Addison-Wesley </A>Publishing Co. Inc.